<?php $post = $this->get('post');?>
<form method="post" action="<?php _e(actionUrl($this))?>" onsubmit="return ajax_form(this)" enctype="multipart/form-data">
<input type="hidden" name="diploma_id" value="<?php _e($post['ID'])?>"/>
	<div class="x-list-title">
		<table width="100%" border="0" height="100%">
			<tr>
				<td align="left">
					<h2>Sửa công văn đến số <?php _e($post['code'])?>
					</h2>
				</td>
				<td align="right">	
					<div class="x-list-options">
					
					</div>
				</td>
			</tr>
		</table>	
	</div>
<div class="x-form-container">
	<div class="form-message"></div>
	<table width="100%" cellpadding="4" class="x-form">
		<tr>
			<td class="x-form-label" >Loại công văn : </td>
			<td class="x-form-input">
				<select name="subtype" class="x-select">
				<?php 
					foreach ($this->get("type") as $k=>$v){
						?>
						<option value="<?php _e($v['ID']);?>"><?php _e($v['title']);?></option>
						<?php
					}
				?>
				</select> 
			</td>
		</tr>
		<tr>
			<td class="x-form-label">Số hiệu : </td>
			<td class="x-form-input">
				<input class="x-text" type="text" name="code"  value="<?php _e($post["code"]);?>"/>
				
			</td>
		</tr>
		<tr>
			<td class="x-form-label">Ngày phát hành : </td>
			<td class="x-form-input">
				<input class="x-text x-date" style type="text" name="date_enactment" onclick="date_picker(this,{noTime:true})"  value="<?php _e(show_date(DATE_FORMAT,$post["date_enactment"]));?>"/>
				&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
				<span class="x-form-label">Ngày đến : </span>
				<input class="x-text x-date" type="text" name="date_get" onclick="date_picker(this,{noTime:true})" value="<?php _e(show_date(DATE_FORMAT,$post['date_get']));?>"/>
			</td>
		</tr>
		
		<tr>
			<td class="x-form-label">Cơ quan ban hành : </td>
			<td class="x-form-input">
				<input class="x-text" type="text" name="ogran_by" style="width:400px;" value="<?php _e($post['ogran_by'])?>"/>
			</td>
		</tr>
		<tr>
			<td class="x-form-label">Trích yếu : </td>
			<td class="x-form-input">
				<textarea name="abstracts" rows="5" cols="40" style="width:605px;" class="x-text" ><?php _e($post["abstracts"]);?></textarea>
			</td>
		</tr>
		<tr>
			<td class="x-form-label">Người tạo : </td>
			<td class="x-form-input">
				<?php 
				_e(get_user_link($this->get('users')))?>
			</td>
		</tr>
		<tr>
			<td class="x-form-label">Gửi xử lý : </td>
			<td class="x-form-input">
				<div class="x-select-users" x-name="usersProc[]" x-title="Gửi để xem">
				<?php
					$usersProc = $this->get('usersProc');
					
					if(isset($usersProc)){
					foreach($usersProc as $user ){?>
					<span class="item">
						<input type="hidden" name="usersProc[]" value="<?php _e($user['ID'])?>"><a><?php _e($user['username'])?></a><span class="close">x</span>
					</span>
				<?php }
					}
				?>	
				</div>
			</td>
		</tr>
		<tr>
			<td class="x-form-label">Gửi phê duyệt:</td>
			<td class="x-form-input">
				<div class="x-select-users" x-name="usersDecide[]" x-title="Gửi phê duyệt">
				<?php
					$usersDecide = $this->get('usersDecide');
					if(isset($usersDecide)){
					foreach($usersDecide as $user ){?>
					<span class="item">
						<input type="hidden" name="usersDecide[]" value="<?php _e($user['ID'])?>"><a><?php _e($user['username'])?></a><span class="close">x</span>
					</span>
				<?php }}?>	
				</div>
			</td>
		</tr>
		<tr>
			<td class="x-form-label">Mức độ ưu tiên xử lý:</td>
			<td class="x-form-input">
				<input type="radio" value="1" class="x-radio"<?php if($post['prior']==1){_e(' checked');}?> name="prior"><span class="p-low">Thấp</span>
				<input type="radio" value="2" class="x-radio"<?php if($post['prior']==2){_e(' checked');}?> name="prior"><span class="p-normal">Bình thường</span>
				<input type="radio" value="3" class="x-radio"<?php if($post['prior']==3){_e(' checked');}?> name="prior"><span class="p-hight">Cao</span>
			</td>
		</tr>
		<tr>
			<td class="x-form-label">Ghi chú:</td>
			<td class="x-form-input">
				<textarea name="desc" rows="5" cols="40" style="width:605px;" class="x-text" ><?php _e($post['desc']);?></textarea>
			</td>
		</tr>
		<tr>
			<td class="x-form-label"><span class="x-attachment"></span></td>
			<td class="x-form-input">
			
				<td class="x-form-input">
				<?php foreach( $this->get('files') as $file ):?>
				
				<div class='x-file-info'>
					<input checked type='checkbox' name='files[]' value='<?php _e($file['ID']);?>'/>
					<a href="<?php _ctrUrl($this);?>/File?ID=<?php _e($file['ID']);?>" target="_blank"><?php _e($file['filename']);?> <?php _e($file['size']);?> KB	</a>
					</div>
					<?php endforeach;?>
					<div class="x-files" url="<?php _baseUrl();?>/Diploma/Index/Upload?ID=<?php _e($post['ID']); ?>" post_id="<?php _e($post['ID'])?>"></div>
				</td>
				
			</td>
		</tr>
		<tr>
			<td class="x-form-label"></td>
			<td>
				<input type="submit" value="Sửa công văn" class="x-button x-save"/>
				<a href="#Diploma" class="x-button x-fresh">Hủy bỏ</a>
			</td>
		</tr>
	</table>
</div>
</form>